package com.zf.zffencheng.util;


import com.zf.zffencheng.model.vo.AdminLoginInfoVo;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class UserContextUtils {

	private static ThreadLocal<AdminLoginInfoVo> adminLoginInfoVoThreadLocal = new ThreadLocal<>();

	private static RedissonClient redissonClient;

	@Autowired
	public void setUserService(RedissonClient redissonClient) {
		UserContextUtils.redissonClient = redissonClient;
	}

	public static void clean() {
		adminLoginInfoVoThreadLocal.set(null);
	}

	public static void setUsers(AdminLoginInfoVo adminLoginInfoVo) {
		adminLoginInfoVoThreadLocal.set(adminLoginInfoVo);
	}

	public static AdminLoginInfoVo getCurrentAdminInfo() {
		return adminLoginInfoVoThreadLocal.get();
	}

}
